/**
 * Created by Administrator on 2018/11/27.
 */
const Koa = require('koa');
const koaBody =require('koa-body');
const router =require('./router');
const session =require('./session');
const _static =require('./staticServer');
const cors = require('./cors');
const gzip =require('./gzip');
const interceptor =require('./interceptor');
const connect =require('./database');

const app = new Koa();
cors(app);
session(app);
_static(app);
// app.use(interceptor);
app.use(koaBody());
router(app);
gzip(app);
connect(app);
// app.use(async function(ctx,next){
//    if(ctx.request.query.name==='111'){  //ctx.request.query 获取get请求的参数
//        ctx.body ='hello,world'; //向客户端返回资源
//    }
//     await next();
// });
// app.use(async function(ctx,next){
// console.log(2);
// await next();
// });
// app.use(async function(ctx,next){
//     console.log(3);
//     await next();
// });
// app.use(async function(ctx,next){
//     console.log(4);
//     await next();
// });

